const {app,BrowserWindow} = require('electron')
const WinState = require('electron-win-state').default
const path = require('path')
require('./controller/capture')
require('./controller/alert')
require('./controller/openWindow')
require('./controller/getFileList')
require('./controller/menu')
const createWindow = () => {
    const winState = new WinState({
        defaultWidth:1000,
        defaultHeight:600 
    })
    const win = new BrowserWindow({
        ...winState.winOptions ,
        webPreferences:{
            preload:path.resolve(__dirname,'./preload/index.js')
        },
        show:false
    })  

    win.loadURL('http://127.0.0.1:5173')
    win.webContents.openDevTools()
    winState.manage(win) 

    win.on('ready-to-show',()=>{
        // 内容加载完才打开窗口
        win.show()
    })
}
 
app.whenReady().then(()=>{
    createWindow()
})